class BrowseRecord < ActiveRecord::Base
  belongs_to :valleyer, :counter_cache => true
  belongs_to :article, :counter_cache => true
  belongs_to :reship, :counter_cache => true
  belongs_to :album, :counter_cache => true
  belongs_to :photo, :counter_cache => true
  belongs_to :meet, :counter_cache => true
  belongs_to :browser,
    :class_name => 'Valleyer',
    :foreign_key => :browser_id

  validates_presence_of :browser_id
  validates_each :browser_id do |model, attr, value|
     model.errors.add(attr, '不记录自己的访问记录')  if value == model.valleyer_id
  end
end
